package br.com.datatraffic.restricao.domain.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data @EqualsAndHashCode(exclude = { "veiculos" }, callSuper = false) @Entity public class Irregularidade {
	@Id @SequenceGenerator(name = "IRREGULARIDADE_SEQ", sequenceName = "IRREGULARIDADE_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "IRREGULARIDADE_SEQ") @Column(name = "IRREGULARIDADE_ID", nullable = false) private Long id;
	private String nome;
	private String descricao;
	@ManyToMany @JoinTable(name = "TBIRREGULARIDADE_VEICULO", joinColumns = { @JoinColumn(name = "IRREGULARIDADE_ID") }, inverseJoinColumns = { @JoinColumn(name = "VEICULO_ID") }) private List<Veiculo> veiculos = new ArrayList<Veiculo>(
			0);
}
